<template>
  <el-form :model="ruleForm" status-icon :rules="rules" ref="ruleForm" label-width="100px" class="demo-ruleForm" v-model="ruleForm">
    <el-form-item label="标题" prop="title">
      <el-input type="text" v-model="ruleForm.title" autocomplete="off" placeholder="请输入表标题" maxlength="50" :show-word-limit="true"></el-input>
    </el-form-item>
    <el-form-item label="内容" prop="content">
      <editor v-model="ruleForm.content" :min-height="192" />
    </el-form-item>
  </el-form>
</template>

<script>
import Editor from '@/components/Editor'
export default {
  name: "editForm",
  components: {
    Editor
  },
  props: ['content'],
  data() {
      return {
        ruleForm: {
          title: '',
          content: this.content
        },
        rules: {
          title: [
            { required: true, trigger: 'blur', message: '请填写标题' }
          ],
        }
      };
    },
    methods: {
      submitForm(formName) {
        this.$refs[formName].validate((valid) => {
          if (valid) {
            alert('submit!');
          } else {
            console.log('error submit!!');
            return false;
          }
        });
      },
      resetForm(formName) {
        this.$refs[formName].resetFields();
      }
    }
};
</script>
<style lang-"scss" scope>

</style>
